#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main(int argc,char *argv[])
{
    int fd;
    char buf[64] = {0};

    fd = open("/dev/my_misc",O_RDWR);

    if(fd < 0)
    {
        perror("open error\n");
        return fd;
    }

    //read(fd,buf,sizeof(buf));//
    //printf("buf is %s\n",buf);//

    buf[0] = atoi(argv[1]);
    write(fd,buf,sizeof(buf));

    if(buf[0] == 1)
        printf("gao dian ping");
    else if(buf[0] == 0)
        printf("di dian ping");

    close(fd);
    return 0;
}

